import React from 'react';
import { View } from 'react-native';
import { Lt, Color, Nav, Label, Jpp, Jx, Flist, Dialog } from "../_utils";
import { Net, NET_GET } from "../_net"
import { ViewLine } from '../_util';

const c_status = ["处理中", "提现完成", "提现失败"];
// 提现记录
export class CashRecord extends React.PureComponent{
    constructor(props){
        super(props);
        
        this.onLoad = this.onLoad.bind(this);
        this.onItem = this.onItem.bind(this);
    }
    static navigationOptions = {
        ...Nav.options,
        headerTitle:"提现记录",
    }
    onLoad(params){
        Net.request("member/queryApply?" + params.pageStr, null, {NET_GET, params}).then(r=>{
            params.add(r.data);
        })
    }
    onItem(params){
        const item = params.item;
        return <View style={{flexDirection:"row", padding:Lt.pad, justifyContent:"space-between", alignItems:"center"}}>
            <Label style={{fontSize:Lt.c20, fontWeight:"900", color:Color.c3}}>
                {item.money}
                <Label style={{fontSize:Lt.c12, color:Color.c3, fontWeight:"normal"}}>元</Label>    
            </Label>
            <View style={{alignItems:"flex-end"}}>
                <Label style={{color: (item.audit == 1) ? Color.c9 : Color.theme}}>{c_status[item.audit]}</Label>
                <Label style={{marginTop:5, color:Color.c9}}>{Jx.toDate(item.createtime)}</Label>
            </View>
        </View>
    }
    render(){
        return <View style = {{flex:1, backgroundColor:"white"}}>
            <Nav.StatusBar/>
            <Flist 
                maxpp={20}
                onLoad = {this.onLoad}
                onItem = {this.onItem}
                ItemSeparatorComponent = {ViewLine}
            />
        </View>;
    }
}